import zoomer from '../zoomer/index.vue'
export default {
  name: "resumeDetail",
  props: {
    userid: String,
    nickName: String
  },
  components:{
    zoomer
  },
  data() {
    return {
      visible: false,
      vitaeinfo: {},
      intensioninfo: {},
      worklist: [],
      projectlist: [],
      educationlist: [],
      trainlist: [],
      options:{
        title: '',
        url: '',
      }
    };
  },
  mounted() {
    this.getInfo();
  },
  methods: {
    zoom(obj){
      this.options ={
        title:'头像',
        url: obj.accessoryid
      }
      this.visible = true
    },
    getInfo() {
      this.$ceshiAxios
        .post("/v1/librarian/resumeInfo", {
          userid: this.userid,
          type: "1"
        })
        .then(res => {
          console.log(res);
          if (res.data.message === "success.") {
            let result = res.data.data;
            this.vitaeinfo = result.vitaeinfo;
            if (this.vitaeinfo && this.vitaeinfo.workyear) {
              if (this.vitaeinfo.workyear < 1) {
                this.vitaeinfo.workyear = "未满1"
              } else {
                this.vitaeinfo.workyear = this.vitaeinfo.workyear
              }
            }
            this.intensioninfo = result.intensioninfo || [];
            this.worklist = result.worklist || [];
            this.projectlist = result.projectlist || [];
            this.educationlist = result.educationlist || [];
            this.trainlist = result.trainlist || [];
			
			console.log(result,'简历信息');
          }else if(res.data.code === 180){
			this.$message({
			  message: '该用户未填写简历信息！',
			  type: "warning"
			});
		  }else {
            this.$message({
              message: res.data.message,
              type: "error"
            });
          }
        });
    },
    print() {
      this.$print(this.$refs.print);
    }
  },
  filters: {
    filterTelnum: function (val) {
      if (!val) return "--";
      if (val) return val.substr(0, 3) + "****" + val.substr(7);
    },
    filterSize: function (val) {
      if (val === "1") {
        return "少于50人";
      } else if (val === "2") {
        return "50-149人";
      } else if (val === "3") {
        return "150-499人";
      } else if (val === "4") {
        return "500-999人";
      } else if (val === "5") {
        return "1000-4999人";
      } else if (val === "6") {
        return "5000-9999人";
      } else if (val === "7") {
        return "10000人以上";
      }
    },
    filterType: function (val) {
      if (val === "1") {
        return "外资（欧美）";
      } else if (val === "2") {
        return "外资（非欧美）";
      } else if (val === "3") {
        return "国企";
      } else if (val === "4") {
        return "合资";
      } else if (val === "5") {
        return "民营公司";
      } else if (val === "6") {
        return "外企代表处";
      } else if (val === "7") {
        return "政府机关";
      } else if (val === "8") {
        return "事业单位";
      } else if (val === "9") {
        return "非营利组织";
      } else if (val === "10") {
        return "上市公司";
      } else if (val === "11") {
        return "创业公司";
      }
    },
    filterEdu: function (val) {
      if (val === "1") {
        return "初中";
      } else if (val === "2") {
        return "高中";
      } else if (val === "3") {
        return "中技";
      } else if (val === "4") {
        return "中专";
      } else if (val === "5") {
        return "大专";
      } else if (val === "6") {
        return "本科";
      } else if (val === "7") {
        return "硕士";
      } else if (val === "8") {
        return "MBA";
      } else if (val === "9") {
        return "博士";
      } else if (val === "10") {
        return "其他";
      }
    }
  }
}